package com.ace.user.api.restful;


import com.alibaba.fastjson.JSONObject;
import com.ace.user.common.bean.ResponseDTO;
import com.ace.user.common.constant.R;
import com.ace.user.module.entity.SystemConfig;
import com.ace.user.module.service.ISystemConfigService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * <p>
 * 用户信息表 前端控制器
 * </p>
 *
 * @author jobObj
 * @since 2019-10-11
 */
@RestController
@RequestMapping("api/v1/user")
public class SystemConfigController {

    @Resource
    private ISystemConfigService systemConfigService;


    @GetMapping("/config/{appId}")
    public SystemConfig onLineUser(@PathVariable(value = "appId") String appId, HttpServletRequest request) {
        SystemConfig systemConfig = systemConfigService.getConfigByAppId(appId);
        return systemConfig;
    }

    @GetMapping("/sftpConfig")
    public Map<String, Object> sftpConfig(@RequestParam(value = "appId") String appId,
                                          @RequestParam(value = "uploadKey") String uploadKey,
                                          HttpServletRequest request) {
        Map<String, Object> config = systemConfigService.sftpConfig(uploadKey);
        return config;
    }
}
